﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BussinessObject;
using EntityDA;

public partial class XuLyDonDatHang : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnChiTiet_Click(object sender, EventArgs e)
    {
        LinkButton link = (LinkButton)sender;
        SachController control = new SachController();
        int MaHD = Int32.Parse(link.CommandArgument);
        GridView2.DataSource = control.GetAllSach(MaHD);
        GridView2.DataBind(); 
    }
    protected void DropTinhTrang_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropTinhTrang.SelectedValue == "1" || DropTinhTrang.SelectedValue == "2")
        {
            DropDownList list = (DropDownList)sender;
            int MaHD = Int32.Parse(list.CssClass);
            HoaDonContronller control = new HoaDonContronller();
            int MaNV = Int32.Parse(list.SelectedValue);
            if (MaNV == -1)
                control.Update(MaNV, MaHD, 1);
            else
                control.Update(MaNV, MaHD, 2);
        }
        GridView1.DataBind();
    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        //if (DropTinhTrang.SelectedValue == "1" || DropTinhTrang.SelectedValue == "2")
        //{
        //    DropDownList list = (DropDownList)sender;
        //    int MaHD = Int32.Parse(list.CssClass);
        //    HoaDonContronller control = new HoaDonContronller();
        //    int MaNV = Int32.Parse(list.SelectedValue);
        //    if (MaNV == -1)
        //        control.Update(MaNV, MaHD, 1);
        //    else
        //        control.Update(MaNV, MaHD, 2);
        //}
        GridView1.DataBind();
    }
}
